/**
 *
 * @param {HTMLCanvasElement} canvas
 */
const createFruit = (canvas) => {
  const x = random(canvas.width - 36, 36);
  const y = 70;
  const height = 36;
  const width = 36;
  const createApple = () => {
    return new FruitShape({
      imageId: ImageNames.apple,
      score: 1,
      speed: 1,
      direction: Direction.down,
      width,
      height,
      x,
      y,
    });
  };
  const createBanana = () => {
    return new FruitShape({
      imageId: ImageNames.banana,
      score: 2,
      speed: 2,
      direction: Direction.down,
      width,
      height,
      x,
      y,
    });
  };
  const createOrange = () => {
    return new FruitShape({
      imageId: ImageNames.orange,
      score: 3,
      speed: 3,
      direction: Direction.down,
      width,
      height,
      x,
      y,
    });
  };
  const createFruitFunList = [
    createApple,
    createApple,
    createApple,
    createBanana,
    createBanana,
    createOrange,
  ];
  const index = random(createFruitFunList.length - 1, 0);
  return createFruitFunList[index]();
};
